package ntd.util.config.common.exception;

import cn.hutool.core.text.StrFormatter;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ComException extends RuntimeException {
    public Integer code = 500;
    public String message;

    public ComException(String message) {
        super(message);
        setMessage(message);
    }

    public ComException(int code, String message) {
        super(message);
        setCode(code);
        setMessage(message);
    }

    public ComException(String message, String ... args) {
        setMessage(StrFormatter.format(message, args));
    }
}
